package com.zbw.bottompopupdialog;

import android.graphics.Color;
import android.support.v4.app.FragmentActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.cc.library.Item;
import com.cc.library.OnItemClickListener;
import com.cc.library.SmartDialog;

import java.util.ArrayList;
import java.util.List;

import cn.pedant.SweetAlert.SweetAlertDialog;

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final List<Item> items = new ArrayList<>();
        items.add(new Item(0,"123213"));
        items.add(new Item(0,"123213"));
        items.add(new Item(0,"123213"));

        findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new SmartDialog().init(MainActivity.this)
                        .items(items)
                        .title("角色选择")
                        .onItemClick(new OnItemClickListener() {
                            @Override
                            public void onItemClick(int position, Item item) {

                            }

                            @Override
                            public void onBtnClick(String editStr) {

                            }
                        })
                        .animEnable(false)
                        .display();
            }
        });

        findViewById(R.id.button2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                new SweetAlertDialog(MainActivity.this)
                        .setTitleText("默认样式")
                        .show();
            }
        });


        findViewById(R.id.button3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SweetAlertDialog md = new SweetAlertDialog(MainActivity.this);
                Window win = md.getWindow();
                win.setGravity(Gravity.CENTER);
                md.setTitle("设置居中！");
                md.show();
                win.setGravity(Gravity.CENTER);
            }
        });



    }
}
